﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Shapes;
using System.Windows;
using System.Windows.Controls;

namespace MigratorUI.RenderEngine
{
    public abstract class Animation : Shape
    {
        public Animation(Sprite sprite, bool isRepeatAnimation)
        {
            this.Sprite = sprite;
            this.isRepeatAnimation = isRepeatAnimation;
        //    this.position = new Point();
            CreateShape();
        }

        public abstract void RunAnimation();
        protected abstract void CreateShape();
     //   public abstract Point GetShapePositionInCanvas();
       
        protected override System.Windows.Media.Geometry DefiningGeometry
        {
            get { throw new NotImplementedException(); }
        }

        protected void AnimationCompleted(){
            if (this.AnimationCompletedEvent != null) this.AnimationCompletedEvent.Invoke(this);
        }

        public void UpdateAnimation(Sprite sprite) {
            CreateShape();
        }

        public Sprite Sprite {get; set;}
        public bool isRepeatAnimation { get; set;}
        public delegate void AnimationCompletedHandler(Animation animation);
        public event AnimationCompletedHandler AnimationCompletedEvent;
    }
}
